c9ae7ba8f3a318867e8e3b2a04389a55b2300b96,plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/DslMembersProcessor.java,DslMembersProcessor,processNonCodeMethods,#PsiType#PsiScopeProcessor#PsiElement#boolean#,35
Before Change
if (psiClass != null) {
final String qname = psiClass.getQualifiedName();
if (qname != null) {
return GroovyDslFileIndex.processExecutors(place, new PairProcessor<GroovyFile, GroovyDslExecutor>() {
public boolean process(GroovyFile groovyFile, GroovyDslExecutor executor) {
final StringBuilder classText = new StringBuilder();
executor.processVariants(new GroovyClassDescriptor(psiClass), new GroovyEnhancerConsumer() {
public void property(String name, String type) {
classText.append("def ").append(type).append(" ").append(name).append("\n");
}
public void method(String name, String type, final LinkedHashMap<String, String> parameters) {
classText.append("def ").append(type).append(" ").append(name).append("(");
classText.append(StringUtil.join(parameters.keySet(), new Function<String, String>() {
public String fun(String s) {
return parameters.get(s) + " " + s;
}
}, ", "));
classText.append(") {}\n");
}
});
if (classText.length() > 0) {
final PsiClass psiClass =
GroovyPsiElementFactory.getInstance(place.getProject()).createGroovyFile("class GroovyEnhanced {\n" + classText + "}", false, place)
.getClasses()[0];
final NameHint nameHint = processor.getHint(NameHint.KEY);
final String expectedName = nameHint == null ? null : nameHint.getName(ResolveState.initial());
for (PsiMethod method : psiClass.getMethods()) {
if ((expectedName == null || expectedName.equals(method.getName())) && !processor.execute(method, ResolveState.initial())) return false;
}
for (final PsiField field : psiClass.getFields()) {
if ((expectedName == null || expectedName.equals(field.getName())) && !processor.execute(field, ResolveState.initial())) return false;
}
}
return true;
}
});
}
}
After Change
final String qname = psiClass.getQualifiedName();
if (qname != null) {
final NonCodeMembersGenerator generator = new NonCodeMembersGenerator(place.getProject());
GroovyDslFileIndex.processExecutors(place, new GroovyClassDescriptor(psiClass), generator);
return generator.processGeneratedMembers(processor);
}
}